//
// Created by LiuYou on 2021/6/20.
//

#include <cstdlib>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>

int main() {
    std::set<std::string> words1{"one", "two", "three", "four", "five", "six"};
    std::set<std::string> words2{"four", "five", "six", "seven", "eight", "nine"};
    std::set<std::string> result;
//    std::set_intersection(std::begin(words1), std::end(words1), std::begin(words2), std::end(words2),
//                          std::inserter(result, std::begin(result)));

//    std::set_intersection(std::begin(words1), std::end(words1), std::begin(words2), std::end(words2),
//                          result);
// Result: "five" "four" "six"

    for (const auto& item : result) {
        std::cout << item << std::endl;
    }


    std::exit(0);
}